package org.example.rxJava;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import rx.Observable;

@Slf4j
public class FilterOperatorDemo {
    @Test
    public void filterDemoLamda() {
        // 对数据进行过滤
        Observable.range(1, 100)
                .filter(t -> {
                    return t % 5 == 0;
                }).subscribe(s -> {
            log.info(String.valueOf(s));
        });
    }

    @Test
    public void distinctDemo() {
        Observable.just("apple", "apple")
                .distinct()
                .subscribe(s->{
                    log.info(s);
                });
    }
}
